angular.module('SimpleDirectiveModule', [])
    .controller('SimpleDirectiveCtrl', ['$scope', function ($scope) {
        $scope.name = 'bitch';
        $scope.changeData=function () {
            $scope.name = 'bitch1123';
            console.log('kill');
        }
    }])
    .directive('myattr', function () {
        return {
            restrict: 'AE',  //A:匹配属性，E：匹配元素
            template: '普通指令 ',
            //替换程度
            link: function (scope,element,attr) {
                element.bind("mouseenter",function () {
                    scope.changeData();
                });
            }
        };
    })

    /**
     * 指令名称 在静态页上 不能有大写，小写或者加中横线
     */
    .directive('myDirective',function () {
        return{
            restrict: 'AE',
            template: '指令属性 ',
            link: function (scope,element,attrs) {
                element.bind("mouseenter",function (event) {
                    scope.$apply(attrs.myattr2); //属性名称不能大写
                });
            }
        };
    })

    //todo  指令交互

;